<template>
	<!-- 添加弹框 -->
	<el-dialog  title="" width="40%"  :modal="false" visible :show-close="false"  class="wrap" @close="cancel" >
		<i class="el-icon-close close" @click="cancel" style="color: white;"></i>
	    <div class="bt">补课单修改</div>
		<el-form label-width="100px" class="form">
			<el-form-item label="老师" >
				<!-- <el-select v-model="vlsid" class="select-block" :readonly='true'>
					<el-option :label="v.mc" :value="v.id" v-for="v in comboxlist" ></el-option>
				</el-select></el-input> -->
				 <el-input v-model="vlsmc" :readonly='true'  icon="info" class="select-block"></el-input>
			</el-form-item>
			<el-form-item label="补课时间">
				<el-date-picker  v-model="vbtime"  type="date" class="select-block" placeholder="" :readonly='true' >  </el-date-picker>

			</el-form-item>
			<el-form-item label="学生">
				<el-tag style="margin-left:10px;" closable :disable-transitions="false"  @close="add(v.id)" v-for="v in xslist">{{v.zwm}}</el-tag>
			</el-form-item>


		</el-form>


		<el-button type="info" class="submit" @click="submit">保存</el-button>
	</el-dialog>
</template>
<script type="text/javascript">
	import qs from 'qs'
	export default {
		props: ['params'],
		data() {
			return {

				vbtime:'',

				comboxlist: [],
				xslist:[],
				dialogTableVisible: true,
			}
		},
		created() {
			console.log(this.params,"1")
			this.getxslist()
			this.vlsid = this.params.row.lsid
			this.vlsmc = this.params.row.lsmc
			this.vbtime = this.params.row.bksj

			// this.getcomboxlist()
		},
		methods: {
			add(id){
				var logininfo = JSON.parse(localStorage.logininfo);
             var params2 = qs.stringify({
                      ids:id,
						xxid: logininfo.xxid,
               })
             //执行
                 this.axios.post(this.$store.state.api + 'xsbkap/deletepl',  params2 )
                 .then(res => {
                  this.$message.error("删除成功")
					this.getxslist()
                 }).catch(res => {
					 console.log(res)
				})
				
				
/*				var logininfo = JSON.parse(localStorage.logininfo);
				// this.searchLoading = true;
				this.axios.get(this.$store.state.api + 'xsbkap/deletepl', {
					params: {
						ids:id,
						xxid: logininfo.xxid,
					}
				}).then(res => {
					this.$message.error("删除成功")
					this.getxslist()
					// console.log(this.comboxlist)
				}).catch(res => {
					console.log(res)
					// this.searchLoading = false;
				})*/
			},
			getxslist() {
				var logininfo = JSON.parse(localStorage.logininfo);
             var params2 = qs.stringify({
                      bkapid:this.params.row.id,
						xxid: logininfo.xxid
               })
             //执行
                 this.axios.post(this.$store.state.api + 'xsbkap/list1',  params2 )
                 .then(res => {
                 console.log(res)
					console.log(121)
					let data = res.data.data;
					let list = data.list;
					this.xslist = list;
                 }).catch(res => {
					 console.log(res)
				})
				
				
				
				
//				var logininfo = JSON.parse(localStorage.logininfo);
//				// this.searchLoading = true;
//				this.axios.get(this.$store.state.api + 'xsbkap/list1', {
//					params: {
//						bkapid:this.params.row.id,
//						xxid: logininfo.xxid
//					}
//				}).then(res => {
//					console.log(res)
//					console.log(121)
//					let data = res.data.data;
//					let list = data.list;
//					this.xslist = list;
//					// console.log(this.comboxlist)
//				}).catch(res => {
//					console.log(res)
//					// this.searchLoading = false;
//				})
			},
			submit() {
				this.$emit('close', { type: 'edit', cancel: true })
				//检测
				// this.$store.state.loading = true;
        //
				// var time1 = this.$.getLocalTimeNo0(Date.parse(this.vbtime));
				// var logininfo = JSON.parse(localStorage.logininfo);
				// var params3 = qs.stringify({
				// 	// lsid:this.vlsid,
				// 	// bksj:time1,
				// 	// // xsid:this.params.row.xsid,
				// 	// id:this.params.row.id,
				// 	// xxid:logininfo.xxid,
				// });
				// //执行
				// this.axios.post(this.$store.state.api + 'bkap/update', params3)
				// 	.then(res => {
				// 		if(res.data.code == 1) {
				// 			this.$emit('close', { type: 'edit', cancel: false });
				// 			this.$store.state.loading = false;
				// 		} else {
				// 			this.$emit('close', { type: 'edit', cancel: false });
				// 			this.$store.state.loading = false;
				// 		}
				// 	}).catch(res => {
				// 		this.$message.warning("服务器繁忙，请重试");
				// 		//this.$emit('close', { type: 'add', cancel: false });
				// 		this.$store.state.loading = false;
				// 	})
			},


			cancel() {
				this.$emit('close', { type: 'edit', cancel: true })
			},
			// getcomboxlist() {
			// 	var logininfo = JSON.parse(localStorage.logininfo);
			// 	// this.searchLoading = true;
			// 	this.axios.get(this.$store.state.api + 'ls/getlslist', {
			// 		params: {
			// 			yhid: logininfo.id,
			// 			xxid: logininfo.xxid
			// 		}
			// 	}).then(res => {
			// 		console.log(res)
			// 		let data = res.data.data;
			// 		let list = data.list;
			// 		this.comboxlist = list;
			// 		console.log(this.comboxlist)
			// 	}).catch(res => {
			// 		console.log(res)
			// 		// this.searchLoading = false;
			// 	})
			// }
		}
	}
</script>
<style lang="less" scoped >
	.wrap {
		.row{
			height:50px;
			line-height: 50px;
		}
		.bt{
			position: absolute;
			width: 100%;
			height: 50px;
			margin: 0 auto;
			top: 0;
			left: 0;
			// margin-top: -70px;
			background: #50BFFF;
			// margin-left: -20px;
			// margin-bottom: 20px;
			color:white;
			text-align:left;
			line-height: 50px;
			font-size: 17px;
			padding-left: 15px;
		}
		.close{
				z-index: 10;
				position: absolute;
		}
		.input-block {
			margin-bottom: 20px;
			text-align: center;
		}
		.input {
			width:280px;
			display: inline-block;
			margin-left: 10px;
		}
		.input1 {
			width: 210px;
			display: inline-block;
			margin-left: 10px;
		}
		.input-block span {
			display: inline-block;
			width: 70px;
			text-align: right;
		}
		.submit {
			width: 120px;
			display: block;
			margin: 0 auto;
			margin-top: 20px;
		}
		.wpfl {
			background: #fff;
			position: absolute;
			top: 5px;
			left: 5px;
		}
		.wpfl1 {
			width: 130%;
			background: #fff;
			position: absolute;
			top: 5px;
			left: -66px;
		}
		.form {
			text-align: left;
			margin-top: 20px;
			.select-block {
				width: 85%;
				display: block;
			}
			.select-block1 {
				width: 68%;
				// display: block;
			}
		}
	}
</style>
